home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
75
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: news.rmii.com!usenet
From: jcoffin@rmii.com (Jerry Coffin)
Newsgroups: comp.std.c
Subject: Re: int's and zero
Date: Wed, 10 Jan 1996 20:16:06 GMT
Organization: TAEUS
Message-ID: <4d12qv$fir@natasha.rmii.com>
References: <4cth4e$4q@odin.funcom.no> <4cub1a$jbl@alterdial.UU.NET>
NNTP-Posting-Host: slip8167.rmii.com
X-Newsreader: Forte Free Agent 1.0.82
rex@aussie.com wrote:
>There was considerable debate about whether or not integers could be stored
>as BCD, Grey code, or some such, but in the end, we decided that they had to
>be stored as binary numbers. And, of course, 2's comp, 1's comp, and signed
>magnitude all use all-bits-zero for zero. The only thing that could cause a
>problem is for machines/compilers with signed zeros; I think that negative
>zero might have some other bit pattern.
Yes -- in one's complement, `-0' is represented with all bits set to 1.
With one's complement, the usual method of testing for 0 is something
like: `if (x+0 == 0)' since the addition of 0 normally produces a
positive 0. If memory serves some of the more widely used one's
complement machines (e.g. CDC 6000/7000/Cyber's) had a pseudo-register
set to a constant value of 0 that came in handy for this.
(Unfortunately, they also used 6 bit characters, so a conforming
implementation of C would have been quite difficult anyway...)
Later,
Jerry.
/* I can barely express my own opinions; I certainly can't
* express anybody else's.
*
* The universe is a figment of its own imagination.
*/